import axios from 'axios';
import Vue from 'vue'
let Interface = axios.create({
    baseURL: 'http://localhost:8080/',
    timeout: 2000,
})
Interface.interceptors.request.use(config => {
    if (!Vue.prototype.Token) {
        console.log('无需携带参数')
    }
    if (config.url == '/api/login') {
        console.log('无需携带参数')
    }
    if (config.url !== '/api/login' && config.url !== '/api/sl') {
        config.headers.common.token = Vue.prototype.Token
    }
    return config
}, error => {
    console.log('请求错误', error)
});
Interface.interceptors.response.use(res => {
    let result = res.data
    return result
}, error => {
    let status = (JSON.parse(JSON.stringify(error))).status
    console.log('响应错误', status)
});
export default Interface